<%@ page language="java"  pageEncoding="UTF-8"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <title>miGLE Home Page</title>
    <%
		java.io.File fastafile = new java.io.File(request.getSession().getServletContext().getRealPath("textfiles/fasta.txt").toString());
		java.io.BufferedReader br = new java.io.BufferedReader(new java.io.InputStreamReader(new java.io.FileInputStream(fastafile)));
		String line = "";
		StringBuffer lines = new StringBuffer();
		while((line = br.readLine()) != null){
			lines.append(line + "\\n");
		}
		br.close();
		String fasta = lines.toString().replace("\"","\\\"").replace("\'","\\\'");
		
		java.io.File snpfile = new java.io.File(request.getSession().getServletContext().getRealPath("textfiles/snp.txt").toString());
		br = new java.io.BufferedReader(new java.io.InputStreamReader(new java.io.FileInputStream(snpfile)));
		line = "";
		lines = new StringBuffer();
		while((line = br.readLine()) != null){
			lines.append(line + "\\n");
		}
		br.close();
		String snp = lines.toString().replace("\"","\\\"").replace("\'","\\\'");
		
		java.io.File dipfile = new java.io.File(request.getSession().getServletContext().getRealPath("textfiles/dip.txt").toString());
		br = new java.io.BufferedReader(new java.io.InputStreamReader(new java.io.FileInputStream(dipfile)));
		line = "";
		lines = new StringBuffer();
		while((line = br.readLine()) != null){
			lines.append(line + "\\n");
		}
		br.close();
		String dip = lines.toString().replace("\"","\\\"").replace("\'","\\\'");
		
		java.io.File gbfile = new java.io.File(request.getSession().getServletContext().getRealPath("textfiles/genebank.txt").toString());
		br = new java.io.BufferedReader(new java.io.InputStreamReader(new java.io.FileInputStream(gbfile)));
		line = "";
		lines = new StringBuffer();
		while((line = br.readLine()) != null){
			lines.append(line + "\\n");
		}
		br.close();
		String genebank = lines.toString().replace("\"","\\\"").replace("\'","\\\'");
	%>
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
	<script>
		function fasta(){
			document.getElementById("f1").sequence.value = "<%=fasta%>" ;
			document.getElementById("fastafiletype").checked = "checked";
		}
		function snp(){
			document.getElementById("f1").sequence.value = "<%=snp%>" ;
			document.getElementById("snpfiletype").checked = "checked";
		}
		function dip(){
			document.getElementById("f1").sequence.value = "<%=dip%>" ;
			document.getElementById("snpfiletype").checked = "checked";
		}
		function genebank(){
			document.getElementById("f1").sequence.value = "<%=genebank%>" ;
			document.getElementById("gbfiletype").checked = "checked";
		}
	</script>
  </head>
  
<BODY>
<jsp:include page="head.html" />
<TABLE cellSpacing=0 cellPadding=0 width=800 align=center border=0>
  <TBODY>
  <TR>
    <TD width=790 rowSpan=2>
      <DIV align=center>
      <TABLE id=table1 cellSpacing=0 cellPadding=0 width="80%" border=0>
        <TBODY>
        <TR>
          <TD>
		  <form action="servlet/InitializationServlet" id="f1" method="post">
		  <table width="693" border="0" cellspacing="1" cellpadding="1">
            <tr>
              <td colspan="2"><div align="left"><strong><font face="Arial"><span class="MsoNormal"><span style="font-size: 10.5pt;"><span lang="en-us"><br><font size="3">Input Reference Sequence </font></span></span><font size="3"><span style="font-size: 10.5pt; font-family: Times New Roman;"><span lang="en-us"><span class="p"><span style="font-size: 10.5pt; font-family: Times New Roman;"><span lang="en-us">:</span></span></span></span></span></font></span></font></strong></div></td>
            </tr>
 
			<tr><td colspan="3"><div align="left"><font face="Arial"><br>Please choose your sequence format&nbsp; (If you choose GENBANK, please choose the region):</font></div></td></tr>
			<tr><td colspan="3" align="left">
			<table>
			<tr>
				<td width="10" height="3"><font face="Arial">&nbsp;</font></td>
			</tr></table>
			<table>
			<tr>
				<td width="10"><font face="Arial">&nbsp;</font></td>
				<td width="500"><div align="left"><font face="Arial" size="2">
			    <strong>Type 1: Analysis for Gain and Loss Events of SNP<br></strong></font></div>
			    </td>
			</tr></table>
			<table>
			<tr>
				<td width="30"><font face="Arial">&nbsp;</font></td>
				<td width="200"><div align="left"><font face="Arial">
				<input type="radio" value="snp" name="filetype" id="snpfiletype" checked />
			    <font size="2"><strong>SNP sequence with IUPAC</strong></font></font></div>
			    </td>
			    <td width="260"><div align="left"><font face="Arial">&nbsp; 
				<strong> <input type="button" value="SNP Example" onclick="snp()" /><input type="button" value="DIP Example" onclick="dip()" /></strong></font></div>
			    </td>
			</tr></table>
			<table>
			<tr>
				<td width="10" height="3"><font face="Arial">&nbsp;</font></td>
			</tr></table>
			<table>
			<tr>
				<td width="10"><font face="Arial">&nbsp;</font></td>
				<td width="500"><div align="left"><font face="Arial" size="2">
			    <strong>Type 2: Analysis for Gain and Loss Profile</strong></font></div>
			    </td>
			</tr></table>
			<table>
			<tr>
				<td width="30"><font face="Arial">&nbsp;</font></td>
				<td width="200"><div align="left"><font face="Arial">
				<input type="radio" value="fasta" name="filetype" id="fastafiletype"/>
			    <font size="2"><strong>FASTA format</strong></font></font></div>
			    </td>
			    <td width="180"><div align="left"><font face="Arial">&nbsp; 
				<strong> <input type="button" value=" Example " onclick="fasta()" /></strong></font></div>
			    </td>
			</tr></table>
			<table>
			<tr>
				<td width="30"><font face="Arial">&nbsp;</font></td>
			    <td width="200"><div align="left"><font face="Arial">
			    <input type="radio" value="genbank" name="filetype" id="gbfiletype"/> 
			    <font size="2"><strong>GenBank format</strong></font></font></div>
			    </td>
			    <td width="180"><div align="left"><font face="Arial">&nbsp; 
			    <strong><input type="button" value=" Example " onclick="genebank()" /></strong></font></div>
			    </td>
			    
			</tr></table>
			<table>
				<tr>
				<td width="65"><font face="Arial">&nbsp;</font></td>
			    <td width="65"><div align="left"><font face="Arial">
			    <input type="radio" value="3utr" name="region" id="region" checked /><font size="2"><strong>3'UTR</strong></font></font></div>
			    </td>
			    <td width="65"><div align="left"><font face="Arial">
			    <input type="radio" value="5utr" name="region" id="region"/><font size="2"><strong>5'UTR</strong></font></font></div>
			    </td>
			    <td width="65"><div align="left"><font face="Arial">
			    <input type="radio" value="cds" name="region" id="region"/><font size="2"><strong>CDS</strong></font></font></div>
			    </td>
			</tr>
			</table>
			</td></tr>
			<tr><td colspan="3"><div align="left"><br>Paste your sequence here<font face="Arial"> (Input one sequence each time)</font>:</div></td></tr>
            <tr>
              <td width="38">&nbsp;</td>
              <td width="503"><div align="left">
                <textarea name="sequence" rows=10 cols=80></textarea>
              </div></td>
			  <td width="142">&nbsp;</td>
            </tr>
            <tr>
			<td>&nbsp;</td>
              <td><div align="right">
                  <INPUT type=submit value=" Submit "> 
                  <INPUT type=reset value=" Clear ">
              </div></td>
			  <td width="142">&nbsp;</td>
			  </tr>
			  
			
          </table></form></TD>
        </TR></TBODY></TABLE></DIV></TD></TR>
  <TR>
    <TD width=1 height=18></TD></TR>
<jsp:include page="end.jsp" />
  </TBODY>
</TABLE>
</BODY>
</html>


